/**
 * @description: Get environment VITE_BASE_URL value
 * @returns:
 * @example:
 */
export function getBaseUrl(): string {
  return getEnvValue<string>('VITE_BASE_URL');
}

export function getPCUrl(): string {
  return getEnvValue<string>('VITE_PC_URL');
}

// 获取站点地址
export function getSiteUrl(): string {
  return getEnvValue<string>('VITE_SITE_URL');
}

// 获取AppId
export function getAppId(): string {
  return getEnvValue<string>('VITE_APPID');
}
export function getSocketUrl(): string {
  return getEnvValue<string>('VITE_GLOB_SOCKET_API_URL');
}
export function getSocketPath(): string {
  return getEnvValue<string>('VITE_SOCKET_PATH');
}
/**
 * @description: Get environment VITE_UPLOAD_URL value
 * @returns:
 * @example:
 */
export function getUploadUrl(): string {
  return getEnvValue<string>('VITE_UPLOAD_URL');
}

export function getEnvValue<T>(keys: string[] | string): T {
  if (Array.isArray(keys)) {
    const obj: any = {};
    keys.forEach((key) => (obj[key] = import.meta.env[key]));
    return obj;
  }
  // @ts-ignore
  return import.meta.env[keys];
}

/**
 * @description: Get environment mode
 * @returns:
 * @example:
 */
export function getEnvMode(): string {
  return getEnvValue<string>('MODE');
}
